﻿<Controls:ChildWindow
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"
    xmlns:m="clr-namespace:Microsoft.Maps.MapControl;assembly=Microsoft.Maps.MapControl" mc:Ignorable="d" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.SL4" xmlns:ViewModels="clr-namespace:Spenta.StreetCare.Silverlight.MVVM.ViewModels" xmlns:UserControls="clr-namespace:Spenta.StreetCare.Silverlight.UserControls" xmlns:local="clr-namespace:Spenta.StreetCare.Silverlight.MVVM.Validations" x:Class="Spenta.StreetCare.Silverlight.UserControls.CreateNewReportChildControl"
    d:DesignHeight="600" d:DesignWidth="500" Width="500">
    <Controls:ChildWindow.Resources>
        <ViewModels:CreateNewReportViewModel x:Key="CreateNewReportViewModel" />
    </Controls:ChildWindow.Resources>

    <Controls:ChildWindow.Template>
        <StaticResource ResourceKey="PopUpWindowStyle" />
    </Controls:ChildWindow.Template>

    <Controls:ChildWindow.Title>
        <TextBlock Text="{Binding Literals.ProblemTitle, Source={StaticResource CreateNewReportViewModel}}" />
    </Controls:ChildWindow.Title>

    <Grid x:Name="LayoutRoot" DataContext="{StaticResource CreateNewReportViewModel}" d:DataContext="{d:DesignData /SampleData/CreateNewReportViewModelSampleData.xaml}">
        <Controls:TabControl x:Name="tabControl1" Style="{StaticResource GenericTabControlStyle}" SelectedIndex="{Binding SelectedSection, Mode=TwoWay}" MinHeight="550">
            <Controls:TabItem Header="{Binding Literals.KindProblem}" Tag="1" x:Name="tabItem1" BorderBrush="#FFEAE4D4" Style="{StaticResource TabItemStyle}" IsEnabled="True">
                <StackPanel>
                    <Grid Margin="10" local:ValidationScope.ValidationScope="{Binding ReportFirstValidationScope}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <StackPanel>
                            <StackPanel Orientation="Horizontal">
                                <dataInput:Label Content="{Binding Literals.KindProblems}" Style="{StaticResource LabelFormDescription}" />
                                <dataInput:DescriptionViewer Description="{Binding Literals.KindProblemInfo}" Target="{Binding ElementName=reportCategorySelector}" Margin="10,0,0,0"  FontWeight="Bold" />
                            </StackPanel>
                            <UserControls:CreateNewReportCategorySelectorUserControl Height="Auto" Margin="0,8"/>
                        </StackPanel>
                        <Button Content="{Binding Literals.ProblemNext}" HorizontalAlignment="Center"  Grid.Row="1" VerticalAlignment="Bottom" Style="{StaticResource WizardButton}" Margin="0,15,0,0">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <cmd:EventToCommand Command="{Binding FirstSectionNextCommand, Mode=OneWay}"/>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </Button>
                    </Grid>
                    <dataInput:ValidationSummary x:Name="FormValidationSummary1" Margin="0,5"/>
                </StackPanel>
            </Controls:TabItem>
            <Controls:TabItem Header="{Binding Literals.WhatProblem}" x:Name="tabItem2" BorderBrush="#FFEAE4D4" Style="{StaticResource TabItemStyle}" Tag="2" IsEnabled="{Binding SecondSectionVisible, Converter={StaticResource VisibilityToBoolConverter}, Mode=TwoWay}">
                <StackPanel>
                    <StackPanel Margin="10" local:ValidationScope.ValidationScope="{Binding ReportSecondValidationScope}">
                		<StackPanel>
                			<dataInput:Label  Content="{Binding Literals.ProblemDescription}" Style="{StaticResource LabelFormDescription}"/>
                			<StackPanel Margin="0,0,0,6" Orientation="Horizontal" Width="450">
                				<TextBox Text="{Binding Report.ReportTitle, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" local:ValidationScope.ValidateBoundProperty="Text" x:Name="ReportTitleTextBox" Width="420" />
                				<dataInput:DescriptionViewer Description="{Binding Literals.ProblemDescriptionInfo}" Target="{Binding ElementName=ReportTitleTextBox}" Margin="5,0,0,0" VerticalContentAlignment="Top" HorizontalContentAlignment="Right" HorizontalAlignment="Left" VerticalAlignment="Top" />
                			</StackPanel>
                			<dataInput:Label Content="{Binding Literals.ProblemWhen}" Margin="0" Style="{StaticResource LabelFormDescription}" />
                			<Controls:DatePicker SelectedDate="{Binding Report.ReportWhen, Mode=TwoWay}" HorizontalAlignment="Left"  x:Name="firstTimeDatePicker" Margin="0,6,0,0"  />

                		</StackPanel>
                		<Button Content="{Binding Literals.ProblemNext}" HorizontalAlignment="Center" x:Name="button1" VerticalAlignment="Top" Style="{StaticResource WizardButton}" >
                			<i:Interaction.Triggers>
                				<i:EventTrigger EventName="Click">
                					<cmd:EventToCommand Command="{Binding SecondSectionNextCommand, Mode=OneWay}"/>
                				</i:EventTrigger>
                			</i:Interaction.Triggers>
                		</Button>
                	</StackPanel>
                    <dataInput:ValidationSummary x:Name="FormValidationSummary2" Margin="0,5"/>
                </StackPanel>
            </Controls:TabItem>
            <Controls:TabItem Header="{Binding Literals.ProblemWhere}" x:Name="tabItem3" Style="{StaticResource TabItemStyle}" Tag="3" IsEnabled="{Binding ThirdSectionVisible, Converter={StaticResource VisibilityToBoolConverter}, Mode=TwoWay}">
                <StackPanel Margin="10,0,10,0" local:ValidationScope.ValidationScope="{Binding ReportThirdValidationScope}">

                    <Grid Margin="0,8,0,10">
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="100" />
                            <ColumnDefinition />
                            <ColumnDefinition Width="25" />
                        </Grid.ColumnDefinitions>
                        <StackPanel Grid.ColumnSpan="2" Orientation="Horizontal" d:LayoutOverrides="Width">
                    		<dataInput:Label Content="{Binding Literals.ProblemAddress}" Style="{StaticResource FormLabelStyle}" Width="100" />
                    		<TextBox x:Name="AddressTextBox" Text="{Binding Address, Mode=TwoWay}" Style="{StaticResource TextBoxInputWizard}" Width="325" />
                    		<UserControls:WaitUserControl Foreground="Orange" IsMoving="{Binding WaitingLocateAddressVisible}" d:LayoutOverrides="Width, HorizontalMargin" />
                    	</StackPanel>
                        <HyperlinkButton Content="{Binding Literals.ProblemAddressMap}" Grid.Column="1" Grid.Row="1" Style="{StaticResource BaseHyperlinkStyle}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <cmd:EventToCommand Command="{Binding LocateAddressCommand, Mode=OneWay}"/>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </HyperlinkButton>
                    </Grid>
                    <dataInput:Label Content="{Binding Literals.ProblemMapInfo}" Style="{StaticResource LabelFormDescription}" />
                    <m:Map x:Name="map" Height="130" VerticalAlignment="Top" CredentialsProvider="AjNra-NpPCp_f1Eq5I3_umNsQDnH2csZuCkwfsi-cmbczt2aW8xiErWmtq3Vqd7b" HorizontalAlignment="Stretch" Margin="0,0,0,15" NavigationVisibility="Visible">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="MouseClick">
                                <cmd:EventToCommand Command="{Binding MapClickCommand, Mode=OneWay}" PassEventArgsToCommand="True"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                        <m:Pushpin Location="{Binding Report.ReportMapLocation}" Visibility="{Binding MapClicked}" Background="{Binding Report.Category.CategoryColor, Converter={StaticResource PushpinTypeBrushConverter}}">
                            <Image Source="{Binding Report.Category.CategoryImageUrl}" />
                        </m:Pushpin>
                    </m:Map>
                    <dataInput:Label Content="{Binding Literals.ProblemLocation}" Style="{StaticResource LabelFormDescription}" />
                    <TextBox x:Name="locationInformationTextBox" Text="{Binding Report.ReportLocation, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True, ValidatesOnExceptions=True}" local:ValidationScope.ValidateBoundProperty="Text" Style="{StaticResource TextBoxInputWizard}" />

                    <dataInput:Label Content="{Binding Literals.ProblemNotification}" Margin="0,15" Style="{StaticResource LabelFormDescription}" />
                    <StackPanel>
                    	<StackPanel Orientation="Horizontal" d:LayoutOverrides="Width" Height="28">
                    		<RadioButton IsChecked="{Binding Report.ReportNotificationTypeID, ConverterParameter=1, Converter={StaticResource BoolToIntConverter}, Mode=TwoWay}" Content="{Binding Literals.ProblemEmail}" x:Name="EmailNotificationRadioButton" Background="{x:Null}" Foreground="Black" Width="225" Style="{StaticResource BaseRadioButton}" />
                    		<TextBox Text="{Binding Report.ReportNotificationDetails, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" local:ValidationScope.ValidateBoundProperty="Text" Visibility="{Binding Report.ReportNotificationTypeID, ConverterParameter=1, Converter={StaticResource VisibilityToIntConverter}}" x:Name="EmailNotificationTextBox"  Margin="0,0,0,5" Style="{StaticResource TextBoxInputWizard}" Width="225" />
                    	</StackPanel>
                    	<StackPanel Height="28" Orientation="Horizontal" d:LayoutOverrides="Width">
                    		<RadioButton IsChecked="{Binding Report.ReportNotificationTypeID, ConverterParameter=2, Converter={StaticResource BoolToIntConverter}, Mode=TwoWay}" Content="{Binding Literals.ProblemSms}" x:Name="SmsMobileNotificationRadioButton" Foreground="Black" Width="225" Style="{StaticResource BaseRadioButton}" />
                    		<TextBox Text="{Binding Report.ReportNotificationDetails, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" local:ValidationScope.ValidateBoundProperty="Text" dataInput:ValidationSummary.ShowErrorsInSummary="false" Visibility="{Binding Report.ReportNotificationTypeID, ConverterParameter=2, Converter={StaticResource VisibilityToIntConverter}}" x:Name="SmsMobileNotificationTextBox" Margin="0,0,0,5" Style="{StaticResource TextBoxInputWizard}" Width="225" />
                    	</StackPanel>
                    </StackPanel>
                    <dataInput:ValidationSummary x:Name="FormValidationSummary3" Margin="0,5"/>
                    <Button Content="{Binding Literals.ProblemSubmit}" HorizontalAlignment="Center" Margin="0" Style="{StaticResource WizardButton}" Width="75">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <cmd:EventToCommand Command="{Binding CreateReportCommand, Mode=OneWay}"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                </StackPanel>
            </Controls:TabItem>
        </Controls:TabControl>
        <UserControls:ChildWindowWaitUserControl Margin="0,0,0,0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="Auto" Height="Auto" d:IsHidden="True" Visibility="{Binding WaitingVisible, Converter={StaticResource VisibilityToBoolConverter}}"/>
    </Grid>
</Controls:ChildWindow>
